<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="com.kylin.module.community.orm.*,
				 com.kylin.common.*,
                 com.kylin.common.util.*,
                 com.kylin.common.paginate.DisplayPage,
				 com.kylin.module.community.orm.*" %>
<%@ include file="/common/include/taglibs.jsp"%>
<%@ include file="/common/include/pageExpires.jsp"%>
<br>

<table>
<form action="/admin/community/managePost.do" method="post">
<input type="hidden" name="CMD" value="searchPost">
	<tr><td colspan="2" align="center"> 查询贴子 </td></tr>
    <tr>
        <td>贴子状态</td>
        <td>
          <select name="active">
              <option value="<%=Post.ALLOW %>" >已发布</option>
              <option value="<%=Post.WAIT %>" >待审核</option>
          </select> 
        </td>
    </tr>
    <tr>
        <td>贴子标题</td><td><input type="text" name="title"></td>
    </tr>
    <tr>
        <td>贴子内容</td><td><input type="text" name="content"></td>
    </tr>
    <tr>
        <td>贴子种类</td><td><input type="text" name="type"></td>
    </tr>
    <tr>
        <td>发贴者用户名 </td><td><input type="text" name="userName"></td>
    </tr>
    <tr>
        <td>发贴者会员名称   </td><td><input type="text" name="name"></td>
    </tr>
    <tr>
        <td>发贴日期   </td>
        <td>
		   从<mytag:CalendarInput name="startDate" id="startDateId" imgId="startDate_img" size="10"/>&nbsp;
		   到<mytag:CalendarInput name="endDate" id="endDate" imgId="endDate_img" size="10" />
        </td>
    </tr>
    <tr>
        <td>贴子语言</td><td><mytag:national name="language" dictName="<%=Constants.ALLLANGUAGE %>"/></td>
    </tr>
	<tr><td colspan="2" align="center"> <input type="submit" value="查询"> </td></tr>
</form>	
</table>
<mytag:MyActionMsg />
<% 
    if(request.getAttribute(Constants.KEY_REQUEST_RESULT)instanceof DisplayPage){
        DisplayPage dispage = (DisplayPage)request.getAttribute(Constants.KEY_REQUEST_RESULT);
%>
		<p align="center"><b>
		<%
		    Short active = null; 
		    if(request.getParameter("active")!=null && !request.getParameter("active").equals("")){
		        active = new Short(request.getParameter("active"));
		        if(Post.ALLOW.equals(active))
		            out.print("已发布");
		        else if(Post.WAIT.equals(active))
		            out.print("待审核");
		    }
		%>          
           帖子列表
        </b></p>
<table class='pageTable' cellspacing='0' cellpadding='0'> 
     <tr>
        <td class='pageTitle'>顺序号</td>
        <td class='pageTitle'>贴子标题</td>
        <td class='pageTitle'>发贴者用户名</td>
        <td class='pageTitle'>会员名称</td>
        <td class='pageTitle'>发贴日期</td>
        <td class='pageTitle'>贴子语言</td>
        <td class='pageTitle'>操作</td>
      </tr>
<%
        for(int i=0;i<dispage.getList().size();i++){
            Post obj = (Post)dispage.getList().get(i);
%>
	    <tr class='row<%=(i%2)%>'> 
	       <td class='pageTd'><%=(i+1) %> </td> 
	       <td class='pageTd'>
	          <a href="/admin/community/managePost.do?CMD=detail&id=<%=obj.getId() %>&page=<%=dispage.getPageNumber() %>&searchId=<%=dispage.getSearchId()%>&active=<%=request.getParameter("active")%>">
	          <%=obj.getTitle() %></a>
	       </td> 
	       <td class='pageTd'><%=obj.getUser().getUsername() %> </td> 
	       <td class='pageTd'><%=obj.getUser().getName() %> </td> 
	       <td class='pageTd'><%=JspHelper.getShowDate( obj.getCreatedon()) %> </td> 
	       <td class='pageTd'><%=UTool.getLanguageName(obj.getLanguage(),Locale.getDefault()) %> </td> 
	       <td class='pageTd'>
	       <%
	          if(!Post.ALLOW.equals(obj.getActive())){
	       %>
	           <a href="/admin/community/managePost.do?CMD=delete&id=<%=obj.getId() %>&page=<%=dispage.getPageNumber() %>&searchId=<%=dispage.getSearchId()%>&active=<%=request.getParameter("active")%>">
	                删除</a> 
	       <%
	           }
	        %>
	       </td> 
	    </tr>
<%            
        }
%>      
</table>
		<%=JspHelper.getPageBar(dispage,request.getRequestURL()+"?CMD=listPost") %>
<%
    }
%>
